package com.lc.luzhengtang.adapter;

import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lc.luzhengtang.R;
import com.lc.luzhengtang.bean.ScoreBeanRecord;
import com.zcx.helper.scale.ScaleScreenHelperFactory;

import java.util.List;

/**
 * 文 件 名: NewsListAdapter
 * 创 建 人: zhangyu
 * 创建日期: 16/12/24 19:55
 * 邮   箱: yuanchong121@gmail.com
 * 修改时间：
 * 修改备注：
 */
public class MyScoreListAdapter extends BaseQuickAdapter<ScoreBeanRecord.DataBeanX.DataBean, BaseViewHolder> {
    private String status;

    public MyScoreListAdapter(List<ScoreBeanRecord.DataBeanX.DataBean> data) {

        super(R.layout.item_myscore, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, ScoreBeanRecord.DataBeanX.DataBean item) {
        ScaleScreenHelperFactory.getInstance().loadView((ViewGroup) helper.convertView);
        helper.setText(R.id.text_newstitle, item.getGoods_title());

        helper.setText(R.id.text_time, item.getCreate_time());
        status=item.getStatus()+"";
        if (status.equals("1")){
            helper.setImageResource(R.id.img_xiaofei,R.mipmap.jifen);
            helper.setTextColor(R.id.text_newstime,mContext.getResources().getColor(R.color.jifen));
            helper.setText(R.id.text_newstime, "+"+item.getIntegral());
            helper.setText(R.id.text_status,"签到获得");
        }else if (status.equals("2")){
            helper.setText(R.id.text_status,"消费获得");
            helper.setImageResource(R.id.img_xiaofei,R.mipmap.myjifen);
            helper.setTextColor(R.id.text_newstime,mContext.getResources().getColor(R.color.xiaofeijifen));
            helper.setText(R.id.text_newstime, "-"+item.getIntegral());
        }
        else if (status.equals(" 3")){
            helper.setText(R.id.text_status,"分享获得");
            helper.setText(R.id.text_newstime, "+"+item.getIntegral());
        }else if (status.equals("4")){
            helper.setText(R.id.text_status,"抵现获得");
            helper.setImageResource(R.id.img_xiaofei,R.mipmap.myjifen);
            helper.setTextColor(R.id.text_newstime,mContext.getResources().getColor(R.color.xiaofeijifen));
            helper.setText(R.id.text_newstime, "-"+item.getIntegral());
        }
        else {
            helper.setImageResource(R.id.img_xiaofei,R.mipmap.myjifen);
            helper.setTextColor(R.id.text_newstime,mContext.getResources().getColor(R.color.xiaofeijifen));
            helper.setText(R.id.text_newstime, "-"+item.getIntegral());
        }

    }


}
